<template>
  <div>
    <el-upload
        class="upload-demo"
        action=""
        :http-request="uploadFile"
        ref="upload"
        :multiple="true"
        :on-change="change"
        :file-list="fileList"
        :auto-upload="false"
    >
      <el-button class="btn"><i class="el-icon-paperclip"></i>上传附件</el-button>
    </el-upload>
  </div>
</template>

<script>
export default {
  data() {
    return {
      documentTypeList: [
        {id: 1, value: '研发'},
        {id: 2, value: '产品'}
      ],
      fileList: [],
      uploadedSet: new Set(),
    };
  },
  mounted() {
  },
  methods: {
    uploadFile() {
    },
    change(file, list) {
      let length = list.length;
      this.fileList = list;

      // 设置新计时器
      setTimeout(() => {
        if (length === this.fileList.length) {
          const param = this.fileList.filter(item => !this.uploadedSet.has(item.name));
          for (let ele of this.fileList) {
            this.uploadedSet.add(ele.name)
          }
          console.log(param);
        }
      }, 100);
    },
  }
};
</script>
